All Questions
Tagged with javaproducer-consumer
24 questions
0votes
0answers
58views
Wait for results/failure of an unreliable async operation
Abstract Problem The basic problem is that of producer/consumer. Wait for an async Producer to [produce an item] or [fail], together with a timeout on the consumer side. Using Java's ...
2votes
1answer
353views
Producer/Consumer Multi-Thread implementation - Is the solution correct?
I recently faced this following question in a Java coding round, needless to say I did not get a callback. So I want to know where I am going wrong in my solution and also what can be done to improve ...
2votes
1answer
214views
Producer-Consumer Semaphore Implementation
I have implemented a Producer-Consumer by Semaphore implementation. I am looking forward to for your code review comments. Thanks. ...
4votes
0answers
386views
Java multithreading many readers one writer implementations
I have a shared data object with writer threads and reader threads. Number of threads can read from the shared data at the same time (in the code getmethod), and ...
2votes
0answers
1kviews
Many-readers-one-writer with semaphores and multithreading
I've been looking for a solution to the may readers one writer in Java. I was intrigued by this question posted here and I read the Wikipedia entry about it. So far, I've reached a fine solution, or ...
2votes
1answer
542views
Producer consumer design and implementation using Java 8
Please review my design and code implementation and suggest if any optimisation is possible in terms of performance (time complexity / space complexity ) or any better way of design or implementation. ...
5votes
1answer
2kviews
Processing a file using Producer/Consumer Model
I am trying to write a multi-threading program which implements the Producer/Consumer model. Typically, I want to use one Producer which reads lines from a file and ...
4votes
3answers
883views
Producer-Consumer with Peterson algorithm in java
Producer-consumer problem in Java with a circular buffer of N positions. There is a single thread representing the producer that will produce consecutive integer elements There is a dimensioned ...
3votes
0answers
315views
Optimal Implementation Choice for Producer-Consumer in Java
I am looking for an optimal producer-consumer implementation in Java with the following aspects: Producer reads from server1 socket, and writes to a shared buffer, as well as another server 2 socket: ...
3votes
3answers
5kviews
Running multiple producer and single consumer in a multithread environment
I have a below class in which add method will be called by multiple threads to populate messageByChannelReference concurrent ...
6votes
1answer
868views
Consumer/Producer (Concurrency) - Exception Handling
I have a circular buffer (array/first in first out), a consumer and a producer. A producer puts random numbers into the array, and a consumer takes the first number and checks if it is relative prime. ...
1vote
2answers
1kviews
One producer and multiple consumers wherein the producer has to wait until all consumers finish before adding more data
I am trying to solve the scenario involving 1 producer and 5 consumers. The producer puts data to queue and waits till all consumers have finished before adding more data. Please review and let me ...
1vote
1answer
500views
Multithreaded Producer-Consumer pattern
I have Producer Threads A, B and C producing 3 different types of events Events A, B and C respectively. The Consumer thread can ...
3votes
4answers
24kviews
Reader-writers problem using semaphores in Java
I have written my own solution to the Reader-Writers problems using semaphores based on the psuedocode from Wikipedia. I would like to gauge the correctness and quality of the code. ...
6votes
1answer
2kviews
Simulation of Multiple Producer Consumer
I am trying to implement the Multiple Producer-Consumer problem. I have made the buffer as the lock to maintain consistency of the system. Does this system actually implement multithreading? How can I ...